package com.bwie.publish.controller;

import java.util.Arrays;
import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.bwie.publish.entity.HousingRingEntity;
import com.bwie.publish.service.HousingRingService;
import com.bwie.common.utils.PageUtils;
import com.bwie.common.utils.R;



/**
 * 
 *
 * @author wangguohai
 * @email 270901876@qq.com
 * @date 2022-04-29 09:52:30
 */
@RestController
@RequestMapping("publish/housingring")
public class HousingRingController {
    @Autowired
    private HousingRingService housingRingService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = housingRingService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{housingRingId}")
    public R info(@PathVariable("housingRingId") Integer housingRingId){
		HousingRingEntity housingRing = housingRingService.getById(housingRingId);

        return R.ok().put("housingRing", housingRing);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody HousingRingEntity housingRing){
		housingRingService.save(housingRing);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody HousingRingEntity housingRing){
		housingRingService.updateById(housingRing);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] housingRingIds){
		housingRingService.removeByIds(Arrays.asList(housingRingIds));

        return R.ok();
    }

}
